﻿using System;
using System.Globalization;
using System.Windows.Data;
using YWM;
using YWM.Localization;

namespace PLCWpfTest.Converters
{
    public class ByteToSexStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                throw new ArgumentNullException("Value can not be null");
            }
            ILocalizationManager lang = YApp.Resolve<ILocalizationManager>();
            string sex = (byte)value == 0 ? lang["男"] : lang["女"];
            return sex;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
